<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="/templates/template.xhtml">
    <ui:define name="title">甲方管理</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-fw fa-edit" update="@form"
                                         rendered="#{loanWholeSaleCommentInfoBean.isView()}"
                                         actionListener="#{loanWholeSaleCommentInfoBean.changeStatusToEdit()}"/>

                        <p:commandButton value="保存" icon="fa fa-save" update="@form"
                                         rendered="#{loanWholeSaleCommentInfoBean.isEdit()}"
                                         onstart="PF('doing').show()"
                                         action="#{loanWholeSaleCommentInfoBean.onCreate()}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <p:dialog header="操作执行中,请稍候" widgetVar="doing" modal="true" closable="false" resizable="false" draggable="false"/>
                <div class="card ui-g-12">
                    <div class="ui-g">
                        <div class="ui-g-12"><h3><b>甲方管理</b></h3></div>
                        <div class="ui-g-2"><p:outputLabel for="ownername" value="甲方名"/></div>
                        <div class="ui-g-4"><p:inputText id="ownername" value="#{loanWholeSaleCommentInfoBean.$.ownername}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="type" value="API编号"/></div>
                        <div class="ui-g-4"><p:inputText id="type" value="#{loanWholeSaleCommentInfoBean.$.type}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="sort" value="排序"/></div>
                        <div class="ui-g-4"><p:inputText id="sort" value="#{loanWholeSaleCommentInfoBean.$.sort}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="number" value="日限量"/></div>
                        <div class="ui-g-4"><p:inputText id="number" value="#{loanWholeSaleCommentInfoBean.$.number}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="total_limet" value="总限量(到达后自动下线)"/></div>
                        <div class="ui-g-4"><p:inputText id="total_limet" value="#{loanWholeSaleCommentInfoBean.$.totalLimit}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>

                        <div class="ui-g-2"><p:outputLabel for="uppertime" value="上线时间"/></div>
                        <div class="ui-g-4"><p:calendar id="uppertime" value="#{loanWholeSaleCommentInfoBean.statrtrequest}" pattern="HH:mm" timeOnly="true"  disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="downtime" value="下线时间"/></div>
                        <div class="ui-g-4"><p:calendar id="downtime" value="#{loanWholeSaleCommentInfoBean.endrequest}" pattern="HH:mm" timeOnly="true"  disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="onlinedate" value="在线周期"/></div>
                        <div class="ui-g-4">
                            <p:selectCheckboxMenu id="onlinedate" value="#{loanWholeSaleCommentInfoBean.weeklist}" label="onlinedateedit" disabled="#{loanWholeSaleCommentInfoBean.isView()}"
                                                      filter="true" filterMatchMode="startsWith" panelStyle="width:250px" multiple="true">
                                        <f:selectItems value="#{loanWholeSaleCommentInfoBean.getWeek()}" />
                                    </p:selectCheckboxMenu>
                        </div>
                        <div class="ui-g-2"><p:outputLabel for="avgprice" value="件均价"/></div>
                        <div class="ui-g-4"><p:inputText id="avgprice" value="#{loanWholeSaleCommentInfoBean.$.avgprice}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="status" value="状态"/></div>
                        <div class="ui-g-4">
                            <p:selectOneMenu id="status" value="#{loanWholeSaleCommentInfoBean.$.status}" disabled="#{loanWholeSaleCommentInfoBean.isView()}">
                                <f:selectItem itemLabel="上线" itemValue="1"/>
                                <f:selectItem itemLabel="下线" itemValue="0" />
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-2"><p:outputLabel for="amount" value="可借总额"/></div>
                        <div class="ui-g-4"><p:inputText id="amount" value="#{loanWholeSaleCommentInfoBean.$.amount}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="approvenum" value="申请人数"/></div>
                        <div class="ui-g-4"><p:inputText id="approvenum" value="#{loanWholeSaleCommentInfoBean.$.approvenum}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="cooperate" value="合作伙伴"/></div>
                        <div class="ui-g-4"><p:inputText id="cooperate" value="#{loanWholeSaleCommentInfoBean.$.cooperate}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="editor" value="操作人"/></div>
                        <div class="ui-g-4"><p:inputText id="editor" value="#{loanWholeSaleCommentInfoBean.$.creator}" disabled="true" style="width:100%"/></div>
                        <div class="ui-g-2"><p:outputLabel  value="外推" for="waitui"/></div>
                        <div class="ui-g-1">
                            <p:inputSwitch id="waitui" onLabel="是" offLabel="否" value="#{loanWholeSaleCommentInfoBean.request.waitui}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/>
                        </div>
                        <div class="ui-g-2"><p:outputLabel  value="站内" for="zhannei"/></div>
                        <div class="ui-g-1">
                            <p:inputSwitch id="zhannei" onLabel="是" offLabel="否" value="#{loanWholeSaleCommentInfoBean.request.zhannei}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/>
                        </div>
                        <div class="ui-g-2"><p:outputLabel for="check_id" value="撞库序号"/></div>
                        <div class="ui-g-4"><p:inputText id="check_id" value="#{loanWholeSaleCommentInfoBean.$.checkId}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>

                        <div class="ui-g-2">
                            <p:outputLabel value="过滤渠道"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectCheckboxMenu value="#{loanWholeSaleCommentInfoBean.request.filterChannel}" label="过滤渠道"
                                                  disabled="#{loanWholeSaleCommentInfoBean.isView()}"
                                                  updateLabel="true" filter="true" filterMatchMode="contains" multiple="true">
                                <f:selectItems value="#{loanWholeSaleCommentInfoBean.getCFrom()}"
                                               var="comeFrom"
                                               itemLabel="#{comeFrom}"
                                               itemValue="#{comeFrom}"/>
                            </p:selectCheckboxMenu>
                        </div>

                        <div class="ui-g-12"><h3><b>用户门槛</b></h3></div>
                        <div class="ui-g-2"><p:outputLabel for="downincome" value="最低月收入"/></div>
                        <div class="ui-g-4"><p:inputText id="downincome" value="#{loanWholeSaleCommentInfoBean.$.income}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="daikuan_amount" value="贷款金额"/></div>
                        <div class="ui-g-4"><p:inputText id="daikuan_amount" value="#{loanWholeSaleCommentInfoBean.$.daikuan_amount}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel  value="年龄范围"/></div>
                        <div class="ui-g-4">
                            <p:inputText id="minage" value="#{loanWholeSaleCommentInfoBean.$.minage}" style="width: 45%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/>
                            <span>~</span>
                            <p:inputText id="maxage" value="#{loanWholeSaleCommentInfoBean.$.maxage}" style="width: 45%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/>
                        </div>
                        <div class="ui-g-2"><p:outputLabel for="hashouse" value="是否有房"/></div>
                        <div class="ui-g-4"><p:inputSwitch id="hashouse" onLabel="是" offLabel="否" value="#{loanWholeSaleCommentInfoBean.request.has_estate}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="has_car" value="是否有车"/></div>
                        <div class="ui-g-4"><p:inputSwitch id="has_car" onLabel="是" offLabel="否"
                                               value="#{loanWholeSaleCommentInfoBean.request.has_car}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="hasshebao" value="是否有社保"/></div>
                        <div class="ui-g-4"><p:inputSwitch id="hasshebao" onLabel="是" offLabel="否" value="#{loanWholeSaleCommentInfoBean.request.social_insurance}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="hasgongjijin" value="是否有公积金"/></div>
                        <div class="ui-g-4"><p:inputSwitch id="hasgongjijin" onLabel="是" offLabel="否" value="#{loanWholeSaleCommentInfoBean.request.house_fund}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="hasxinyongka" value="是否有信用卡"/></div>
                        <div class="ui-g-4"><p:inputSwitch id="hasxinyongka" onLabel="是" offLabel="否" value="#{loanWholeSaleCommentInfoBean.request.credit}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="hasweilidai" value="是否有微粒贷"/></div>
                        <div class="ui-g-4"><p:inputSwitch id="hasweilidai" onLabel="是" offLabel="否" value="#{loanWholeSaleCommentInfoBean.request.has_weilidai}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="hasshoubao" value="是否有寿保"/></div>
                        <div class="ui-g-4"><p:inputSwitch id="hasshoubao" onLabel="是" offLabel="否" value="#{loanWholeSaleCommentInfoBean.request.life_insurance}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="shebaodate" value="社保缴纳时长"/></div>
                        <div class="ui-g-4"><p:inputText id="shebaodate" value="#{loanWholeSaleCommentInfoBean.$.social_insuranceduration}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>
                        <div class="ui-g-2"><p:outputLabel for="gongjijindate" value="公积金缴纳时长"/></div>
                        <div class="ui-g-4"><p:inputText id="gongjijindate" value="#{loanWholeSaleCommentInfoBean.$.house_fundduration}" style="width:100%" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/></div>

                        <div class="ui-g-2"><p:outputLabel for="userarea" value="用户地区"/></div>
                        <div class="ui-g-4">
                            <p:selectCheckboxMenu id="userarea" value="#{loanWholeSaleCommentInfoBean.reginlist}" label="commregioninfo"
                                                  disabled="#{loanWholeSaleCommentInfoBean.isView()}" filter="true"
                                                  filterMatchMode="startsWith" panelStyle="width:250px">
                                <p:ajax event="change" process="@this"
                                        listener="#{loanWholeSaleCommentInfoBean.areaChange()}"/>
                                <f:selectItems value="#{loanWholeSaleCommentInfoBean.findAllRegionInfo()}" var="regioninfo"
                                           itemValue="#{regioninfo.getName()}" itemLabel="#{regioninfo.getName()}"/>
                            </p:selectCheckboxMenu>
                        </div>
                        <div class="ui-g-2">
                            <p:commandButton value="查看选择城市" icon="fa fa-plus"
                                             oncomplete="PF('seecity').show()"
                                             process="@this" update="viewcity"/>
                        </div>

                        <div class="ui-g-2">
                            <p:commandButton value="配置城市限量" icon="fa fa-pie-chart"
                                             oncomplete="PF('view-limit').show()"
                                             process="@this" update="view-limit"/>
                        </div>

                        <p:dialog id="viewcity" header="选中城市" position="center" widgetVar="seecity"
                                  modal="true" width="500px">
                            <p:panelGrid columns="1"
                                         columnClasses="ui-grid-col-12"
                                         layout="grid" styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">
                                <p:inputTextarea rows="10" cols="50"  value="#{loanWholeSaleCommentInfoBean.cityInfo}" queryDelay="750" minQueryLength="4" disabled="true"/>
                            </p:panelGrid>
                        </p:dialog>

                        <p:dialog id="view-limit" header="各城市配置详情" position="center" widgetVar="view-limit"
                                  modal="true" styleClass="ui-g-6">
                            <div class="ui-g-12">
                                <c:forEach var="info" items="#{loanWholeSaleCommentInfoBean.limitInfoList}">
                                    <div class="ui-g-2">
                                        <p:outputLabel value="#{info.cityName}" disabled="#{loanWholeSaleCommentInfoBean.isView()}"/>
                                    </div>
                                    <div class="ui-g-4">
                                        <p:inputNumber value="#{info.limitValue}" decimalPlaces="0"
                                                       disabled="#{loanWholeSaleCommentInfoBean.isView()}"/>
                                    </div>
                                </c:forEach>
                            </div>
                            <div class="ui-g-12">
                                <div class="ui-g-10"/>
                                <div class="ui-g-2">
                                    <p:commandButton value="保存" icon="fa fa-save"
                                                     rendered="#{loanWholeSaleCommentInfoBean.limitInfoList.size()>0}"
                                                     disabled="#{loanWholeSaleCommentInfoBean.isView()}"
                                                     process="view-limit" update="view-limit" oncomplete="PF('seecity').hide()"/>
                                </div>
                            </div>
                        </p:dialog>

                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
